package com.bee2c.zas.home.timer;

import javax.annotation.Resource;

import org.quartz.JobExecutionContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.bee2c.pub.home.task.TaskProcessFactory;
import com.bee2c.pub.quartz.JobSchedule;
import com.bee2c.pub.quartz.SerializableTimerJob;

/**
 * 订单处理任务
 */
@JobSchedule(fixedRate = 10 * 1000, desc = "zas任务执行定时器")
@Configuration
public class ZasTaskTimer extends SerializableTimerJob {

	@Resource
	TaskProcessFactory inTask;

	@Resource
	TaskProcessFactory outTask;

	@Override
	public String executeJob(JobExecutionContext context) throws Exception {
		inTask.process();
		outTask.process();
		return "执行完成";
	}

	@Bean(name = "inTask")
	public TaskProcessFactory inTask() {
		return new TaskProcessFactory("ZAS_TASK_IN", 50, 5);
	}

	@Bean(name = "outTask")
	public TaskProcessFactory outTask() {
		return new TaskProcessFactory("ZAS_TASK_OUT", 50, 5);
	}

}
